package com.yanqu.road.server.manger.cricket.skillhandler.attround.handler;

import com.yanqu.road.pb.cricket.CricketProto;
import com.yanqu.road.server.gameplayer.module.cricket.battle.CricketGame;
import com.yanqu.road.server.gameplayer.module.cricket.model.BattleData;
import com.yanqu.road.server.gameplayer.module.cricket.model.SkillData;
import com.yanqu.road.server.manger.cricket.skillhandler.startround.CricketSkillStartRoundStrategy;

public class CricketSkill401Strategy implements CricketSkillStartRoundStrategy {

    /**
     * 每次被攻击前，关羽激发内在的武圣之力，获得{0}的伤害减免，加成可叠加。
     * @param cricketGame 本局对局对象
     * @param skillData 技能数据
     * @param action 我方
     * @param target 对方
     * @param roundId 第几回合
     * @param attackRoundBuilder 返回PB结构体
     * @return
     */
    @Override
    public boolean skillHandle(CricketGame cricketGame, SkillData skillData, BattleData action, BattleData target, int roundId, CricketProto.CricketAttackRound.Builder attackRoundBuilder) {
        skillData.effectAmountInc();
        //增加伤害减免千分比
        target.addParam(skillData.getSkillEffect().getP1());
        //封装返回数据
        CricketProto.CricketBattleFrame.Builder newBattleFrameBuilder = cricketGame.newBattleFrameBuilder();
        newBattleFrameBuilder.setActionUserId(target.getUserId());
        newBattleFrameBuilder.setTargetUserId(target.getUserId());
        newBattleFrameBuilder.setSkillId(skillData.getSkillId());
        cricketGame.fillRemainHp(newBattleFrameBuilder);
        attackRoundBuilder.addStartRound(newBattleFrameBuilder);
        return false;
    }
}
